From 19febc847d6e38aa795231f3d127649ef27200e6 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Tue, 11 Aug 2026 22:05:20 +0000 Subject: [PATCH] Change column name: ARRIVALS.Cycle -> ARRIVALS.Swelling --- conversion/load_follow_arrival.m4 | 2 +- .../lib/triggers/create/biography_data.m4 | 72 +++++++++---------- db/schemas/lib/triggers/create/events.m4 | 18 ++--- db/schemas/lib/triggers/create/roles.m4 | 10 +-- db/schemas/lib/triggers/create/watches.m4 | 52 +++++++------- .../functions/create/build_swelling_states.m4 | 6 +- db/schemas/sokwedb/indexes/create/arrivals.m4 | 4 +- db/schemas/sokwedb/indexes/drop/arrivals.m4 | 2 +- db/schemas/sokwedb/tables/create/arrivals.m4 | 2 +- doc/src/epilog.inc.m4 | 4 +- doc/src/functions/build_swelling_states.m4 | 2 +- doc/src/tables/arrivals.m4 | 12 ++-- doc/src/views/brec_notes_view.m4 | 2 +- 13 files changed, 94 insertions(+), 94 deletions(-) diff --git a/conversion/load_follow_arrival.m4 b/conversion/load_follow_arrival.m4 index 1ecd569..1dde083 100644 --- a/conversion/load_follow_arrival.m4 +++ b/conversion/load_follow_arrival.m4 @@ -93,7 +93,7 @@ BEGIN eid , neststart , nestend - , cycle + , swelling , datasource , updated) VALUES ( diff --git a/db/schemas/lib/triggers/create/biography_data.m4 b/db/schemas/lib/triggers/create/biography_data.m4 index 177ae9e..ac90525 100644 --- a/db/schemas/lib/triggers/create/biography_data.m4 +++ b/db/schemas/lib/triggers/create/biography_data.m4 @@ -835,7 +835,7 @@ CREATE OR REPLACE FUNCTION biography_data_func () -- ARRIVALS DECLARE -- ARRIVALS - a_cycle arrivals.cycle%TYPE; + a_swelling arrivals.swelling%TYPE; -- EVENTS a_eid events.eid%TYPE; a_behavior events.behavior%TYPE; @@ -850,7 +850,7 @@ CREATE OR REPLACE FUNCTION biography_data_func () a_role roles.role%TYPE; BEGIN - -- Check ARRIVALS.Cycle + -- Check Arrivals.Swelling IF NEW.sex = 'sdb_female' THEN IF NEW.sex <> OLD.sex THEN @@ -862,18 +862,18 @@ CREATE OR REPLACE FUNCTION biography_data_func () -- wrong explaination for why the swelling code was rejected. SELECT roles.role , events.eid, events.behavior, events.start, events.stop - , arrivals.cycle + , arrivals.swelling , watches.wid, watches.animid, watches.date, watches.type INTO a_role , a_eid , a_behavior , a_start , a_stop - , a_cycle + , a_swelling , a_wid , a_animid , a_date , a_type FROM roles JOIN events ON (events.eid = roles.eid) JOIN arrivals ON (arrivals.eid = roles.eid) JOIN watches ON (watches.wid = events.wid) WHERE roles.participant = NEW.animid - AND arrivals.cycle = 'sdb_male_swelling' + AND arrivals.swelling = 'sdb_male_swelling' -- Produce a consistent error message ORDER BY watches.date, watches.wid , events.start, events.stop, events.eid @@ -904,8 +904,8 @@ CREATE OR REPLACE FUNCTION biography_data_func () || a_stop || '): Key (ARRIVALS.EID) = (' || a_eid - || '), Value (ARRIVALS.Cycle) = (' - || a_cycle + || '), Value (Arrivals.Swelling) = (' + || a_swelling || '): Key (WATCHES.WID) = (' || a_wid || '), Value (WATCHES.AnimID) = (' @@ -930,18 +930,18 @@ CREATE OR REPLACE FUNCTION biography_data_func () -- adolescent females. -- Can't be too young. SELECT roles.role , events.eid, events.behavior, events.start, events.stop - , arrivals.cycle + , arrivals.swelling , watches.wid, watches.animid, watches.date, watches.type INTO a_role , a_eid , a_behavior , a_start , a_stop - , a_cycle + , a_swelling , a_wid , a_animid , a_date , a_type FROM roles JOIN events ON (events.eid = roles.eid) JOIN arrivals ON (arrivals.eid = roles.eid) JOIN watches ON (watches.wid = events.wid) WHERE roles.participant = NEW.animid - AND arrivals.cycle = 'sdb_adolescent_swelling' + AND arrivals.swelling = 'sdb_adolescent_swelling' AND NEW.birthdate > (watches.date - 'sdb_min_adolescent_age sdb_min_adolescent_age_units'::INTERVAL @@ -979,8 +979,8 @@ CREATE OR REPLACE FUNCTION biography_data_func () || a_stop || '): Key (ARRIVALS.EID) = (' || a_eid - || '), Value (ARRIVALS.Cycle) = (' - || a_cycle + || '), Value (Arrivals.Swelling) = (' + || a_swelling || '): Key (WATCHES.WID) = (' || a_wid || '), Value (WATCHES.AnimID) = (' @@ -997,18 +997,18 @@ CREATE OR REPLACE FUNCTION biography_data_func () -- adolescent females. -- Can't be too old. SELECT roles.role , events.eid, events.behavior, events.start, events.stop - , arrivals.cycle + , arrivals.swelling , watches.wid, watches.animid, watches.date, watches.type INTO a_role , a_eid , a_behavior , a_start , a_stop - , a_eid , a_cycle + , a_eid , a_swelling , a_wid , a_animid , a_date , a_type FROM roles JOIN events ON (events.eid = roles.eid) JOIN arrivals ON (arrivals.eid = roles.eid) JOIN watches ON (watches.wid = events.wid) WHERE roles.participant = NEW.animid - AND arrivals.cycle = 'sdb_adolescent_swelling' + AND arrivals.swelling = 'sdb_adolescent_swelling' AND NEW.birthdate <= (watches.date - '1 sdb_max_adolescent_age_units'::INTERVAL @@ -1047,8 +1047,8 @@ CREATE OR REPLACE FUNCTION biography_data_func () || a_stop || '): Key (ARRIVALS.EID) = (' || a_eid - || '), Value (ARRIVALS.Cycle) = (' - || a_cycle + || '), Value (Arrivals.Swelling) = (' + || a_swelling || '): Key (WATCHES.WID) = (' || a_wid || '), Value (WATCHES.AnimID) = (' @@ -1069,20 +1069,20 @@ CREATE OR REPLACE FUNCTION biography_data_func () -- Can't be too young. SELECT roles.role , events.eid, events.behavior, events.start, events.stop - , arrivals.cycle + , arrivals.swelling , watches.wid, watches.animid, watches.date, watches.type INTO a_role , a_eid , a_behavior , a_start , a_stop - , a_eid , a_cycle + , a_eid , a_swelling , a_wid , a_animid , a_date , a_type FROM roles JOIN events ON (events.eid = roles.eid) JOIN arrivals ON (arrivals.eid = roles.eid) JOIN watches ON (watches.wid = events.wid) WHERE roles.participant = NEW.animid - AND arrivals.cycle <> 'sdb_no_swelling' - AND arrivals.cycle <> 'sdb_adolescent_swelling' - AND arrivals.cycle <> 'sdb_missing_swelling' + AND arrivals.swelling <> 'sdb_no_swelling' + AND arrivals.swelling <> 'sdb_adolescent_swelling' + AND arrivals.swelling <> 'sdb_missing_swelling' AND NEW.birthdate > (watches.date - 'sdb_min_swelling_age sdb_min_swelling_age_units'::INTERVAL @@ -1119,8 +1119,8 @@ CREATE OR REPLACE FUNCTION biography_data_func () || a_stop || '): Key (ARRIVALS.EID) = (' || a_eid - || '), Value (ARRIVALS.Cycle) = (' - || a_cycle + || '), Value (Arrivals.Swelling) = (' + || a_swelling || '): Key (WATCHES.WID) = (' || a_wid || '), Value (WATCHES.AnimID) = (' @@ -1136,20 +1136,20 @@ CREATE OR REPLACE FUNCTION biography_data_func () -- Can't be too old and still have a sexual swelling. SELECT roles.role , events.eid, events.behavior, events.start, events.stop - , arrivals.cycle + , arrivals.swelling , watches.wid, watches.animid, watches.date, watches.type INTO a_role , a_eid , a_behavior , a_start , a_stop - , a_cycle + , a_swelling , a_wid , a_animid , a_date , a_type FROM roles JOIN events ON (events.eid = roles.eid) JOIN arrivals ON (arrivals.eid = roles.eid) JOIN watches ON (watches.wid = events.wid) WHERE roles.participant = NEW.animid - AND arrivals.cycle <> 'sdb_no_swelling' - AND arrivals.cycle <> 'sdb_adolescent_swelling' - AND arrivals.cycle <> 'sdb_missing_swelling' + AND arrivals.swelling <> 'sdb_no_swelling' + AND arrivals.swelling <> 'sdb_adolescent_swelling' + AND arrivals.swelling <> 'sdb_missing_swelling' AND NEW.birthdate <= (watches.date - '1 sdb_max_swelling_age_units'::INTERVAL @@ -1187,8 +1187,8 @@ CREATE OR REPLACE FUNCTION biography_data_func () || a_stop || '): Key (ARRIVALS.EID) = (' || a_eid - || '), Value (ARRIVALS.Cycle) = (' - || a_cycle + || '), Value (Arrivals.Swelling) = (' + || a_swelling || '): Key (WATCHES.WID) = (' || a_wid || '), Value (WATCHES.AnimID) = (' @@ -1209,18 +1209,18 @@ CREATE OR REPLACE FUNCTION biography_data_func () IF NEW.sex <> OLD.sex THEN SELECT roles.role , events.eid, events.behavior, events.start, events.stop - , arrivals.cycle + , arrivals.swelling , watches.wid, watches.animid, watches.date, watches.type INTO a_role , a_eid , a_behavior , a_start , a_stop - , a_cycle + , a_swelling , a_wid , a_animid , a_date , a_type FROM roles JOIN events ON (events.eid = roles.eid) JOIN arrivals ON (arrivals.eid = roles.eid) JOIN watches ON (watches.wid = events.wid) WHERE roles.participant = NEW.animid - AND arrivals.cycle <> 'sdb_male_swelling' + AND arrivals.swelling <> 'sdb_male_swelling' -- Produce a consistent error message ORDER BY watches.date, watches.wid , events.start, events.stop, events.eid @@ -1251,8 +1251,8 @@ CREATE OR REPLACE FUNCTION biography_data_func () || a_stop || '): Key (ARRIVALS.EID) = (' || a_eid - || '), Value (ARRIVALS.Cycle) = (' - || a_cycle + || '), Value (Arrivals.Swelling) = (' + || a_swelling || '): Key (WATCHES.WID) = (' || a_wid || '), Value (WATCHES.AnimID) = (' diff --git a/db/schemas/lib/triggers/create/events.m4 b/db/schemas/lib/triggers/create/events.m4 index 5f32af8..f3bcfe0 100644 --- a/db/schemas/lib/triggers/create/events.m4 +++ b/db/schemas/lib/triggers/create/events.m4 @@ -176,7 +176,7 @@ CREATE OR REPLACE FUNCTION events_insert_commit_func () a_seq arrivals.seq%TYPE; a_neststart arrivals.neststart%TYPE; a_nestend arrivals.nestend%TYPE; - a_cycle arrivals.cycle%TYPE; + a_swelling arrivals.swelling%TYPE; a_datasource arrivals.datasource%TYPE; -- WATCHES a_wid watches.wid%TYPE; @@ -190,11 +190,11 @@ CREATE OR REPLACE FUNCTION events_insert_commit_func () BEGIN -- A related FOLLOW_OBSERVERS row must exist. SELECT arrivals.seq, arrivals.neststart - , arrivals.nestend, arrivals.cycle, arrivals.datasource + , arrivals.nestend, arrivals.swelling, arrivals.datasource , watches.wid, watches.animid, watches.date , roles.pid, roles.role, roles.participant INTO a_seq , a_neststart - , a_nestend , a_cycle , a_datasource + , a_nestend , a_swelling , a_datasource , a_wid , a_animid , a_date , a_pid , a_role , a_participant FROM watches @@ -234,8 +234,8 @@ CREATE OR REPLACE FUNCTION events_insert_commit_func () || a_neststart || '): Value (ARRIVALS.NestEnd) = (' || a_nestend - || '): Value (ARRIVALS.Cycle) = (' - || a_cycle + || '): Value (Arrivals.Swelling) = (' + || a_swelling || '): Value (ARRIVALS.datasource) = (' || a_datasource || '): Key (ROLES.PID) = (' @@ -282,7 +282,7 @@ CREATE OR REPLACE FUNCTION events_delete_commit_func () a_seq arrivals.seq%TYPE; a_neststart arrivals.neststart%TYPE; a_nestend arrivals.nestend%TYPE; - a_cycle arrivals.cycle%TYPE; + a_swelling arrivals.swelling%TYPE; a_datasource arrivals.datasource%TYPE; -- EVENTS a_behavior events.behavior%TYPE; @@ -302,12 +302,12 @@ CREATE OR REPLACE FUNCTION events_delete_commit_func () -- Within the follow, for N > 1 Is there a Seq = N+1 row, -- but not a Seq = N row? SELECT arrivals.seq, arrivals.neststart - , arrivals.nestend, arrivals.cycle, arrivals.datasource + , arrivals.nestend, arrivals.swelling, arrivals.datasource , events.behavior, events.start, events.stop , watches.wid, watches.animid, watches.date , roles.pid, roles.role, roles.participant INTO a_seq , a_neststart - , a_nestend , a_cycle , a_datasource + , a_nestend , a_swelling , a_datasource , a_behavior , a_start , a_stop , a_wid , a_animid , a_date , a_pid , a_role , a_participant @@ -350,7 +350,7 @@ CREATE OR REPLACE FUNCTION events_delete_commit_func () || '): Value (NestEnd) = (' || a_nestend || '): Value (Cycle) = (' - || a_cycle + || a_swelling || '): Value (datasource) = (' || a_datasource || '): Key (ROLES.PID) = (' diff --git a/db/schemas/lib/triggers/create/roles.m4 b/db/schemas/lib/triggers/create/roles.m4 index 24cdbfa..85d9fc3 100644 --- a/db/schemas/lib/triggers/create/roles.m4 +++ b/db/schemas/lib/triggers/create/roles.m4 @@ -56,7 +56,7 @@ CREATE OR REPLACE FUNCTION roles_func () cannot_change(`ROLES', `Role') -- Allowing the Participant to change means that this trigger must - -- check ARRIVALS.Cycle against sex and birthdate. And maybe + -- check Arrivals.Swelling against sex and birthdate. And maybe -- other checks. This is simpler. cannot_change(`ROLES', `Participant') END IF; @@ -603,7 +603,7 @@ CREATE OR REPLACE FUNCTION roles_delete_func () a_seq arrivals.seq%TYPE; a_neststart arrivals.neststart%TYPE; a_nestend arrivals.nestend%TYPE; - a_cycle arrivals.cycle%TYPE; + a_swelling arrivals.swelling%TYPE; BEGIN -- Function for roles delete trigger -- @@ -616,12 +616,12 @@ CREATE OR REPLACE FUNCTION roles_delete_func () , watches.wid , watches.animid, watches.date, watches.type, watches.commid , arrivals.seq, arrivals.neststart, arrivals.nestend - , arrivals.cycle + , arrivals.swelling INTO a_start , a_stop , a_wid , a_animid , a_date , a_type , a_commid , a_seq , a_neststart , a_nestend - , a_cycle + , a_swelling FROM events JOIN watches ON (watches.wid = events.wid) , arrivals @@ -665,7 +665,7 @@ CREATE OR REPLACE FUNCTION roles_delete_func () || '), Value (NestStart) = (' || a_nestend || '), Value (Cycle) = (' - || a_cycle + || a_swelling || ')' , HINT = 'To delete this row, use a transaction and' || ' first delete the related ARRIVALS row.'; diff --git a/db/schemas/lib/triggers/create/watches.m4 b/db/schemas/lib/triggers/create/watches.m4 index ca1d269..74b709e 100644 --- a/db/schemas/lib/triggers/create/watches.m4 +++ b/db/schemas/lib/triggers/create/watches.m4 @@ -121,7 +121,7 @@ CREATE OR REPLACE FUNCTION watches_func () a_entrydate biography_data.entrydate%TYPE; a_departdate biography_data.departdate%TYPE; -- ARRIVALS - a_cycle arrivals.cycle%TYPE; + a_swelling arrivals.swelling%TYPE; BEGIN -- The participants in an event cannot be in a follow that is @@ -229,18 +229,18 @@ CREATE OR REPLACE FUNCTION watches_func () END IF; - -- Validate the ARRIVALS.Cycle + -- Validate the Arrivals.Swelling -- The sdb_adolescent_swelling code (U) can only be assigned to -- adolescent females. -- Can't be too young. SELECT events.eid, events.behavior, events.start, events.stop , roles.pid, roles.role, roles.participant , biography_data.sex, biography_data.birthdate - , arrivals.cycle + , arrivals.swelling INTO a_eid , a_behavior , a_start , a_stop , a_pid , a_role , a_participant , a_sex , a_birthdate - , a_cycle + , a_swelling FROM events JOIN roles ON (roles.eid = events.eid) @@ -252,7 +252,7 @@ CREATE OR REPLACE FUNCTION watches_func () AND roles.participant <> 'sdb_stranger_female2' AND roles.participant <> 'sdb_stranger_female3' AND biography_data.sex = 'sdb_female' - AND arrivals.cycle = 'sdb_adolescent_swelling' + AND arrivals.swelling = 'sdb_adolescent_swelling' AND biography_data.birthdate > (NEW.date - 'sdb_min_adolescent_age sdb_min_adolescent_age_units'::INTERVAL @@ -295,8 +295,8 @@ CREATE OR REPLACE FUNCTION watches_func () || a_birthdate || '): Key (ARRIVALS.EID) = (' || a_eid - || '), Value (ARRIVALS.Cycle) = (' - || a_cycle + || '), Value (Arrivals.Swelling) = (' + || a_swelling || ')' , HINT = 'sdb_follow_age_hint'; END IF; @@ -306,11 +306,11 @@ CREATE OR REPLACE FUNCTION watches_func () SELECT events.eid, events.behavior, events.start, events.stop , roles.pid, roles.role, roles.participant , biography_data.sex, biography_data.birthdate - , arrivals.cycle + , arrivals.swelling INTO a_eid , a_behavior , a_start , a_stop , a_pid , a_role , a_participant , a_sex , a_birthdate - , a_cycle + , a_swelling FROM events JOIN roles ON (roles.eid = events.eid) @@ -322,7 +322,7 @@ CREATE OR REPLACE FUNCTION watches_func () AND roles.participant <> 'sdb_stranger_female2' AND roles.participant <> 'sdb_stranger_female3' AND biography_data.sex = 'sdb_female' - AND arrivals.cycle = 'sdb_adolescent_swelling' + AND arrivals.swelling = 'sdb_adolescent_swelling' AND biography_data.birthdate <= (NEW.date - '1 sdb_max_adolescent_age_units'::INTERVAL @@ -366,8 +366,8 @@ CREATE OR REPLACE FUNCTION watches_func () || a_birthdate || '): Key (ARRIVALS.EID) = (' || a_eid - || '), Value (ARRIVALS.Cycle) = (' - || a_cycle + || '), Value (Arrivals.Swelling) = (' + || a_swelling || ')' , HINT = 'sdb_follow_age_hint'; END IF; @@ -381,11 +381,11 @@ CREATE OR REPLACE FUNCTION watches_func () SELECT events.eid, events.behavior, events.start, events.stop , roles.pid, roles.role, roles.participant , biography_data.sex, biography_data.birthdate - , arrivals.cycle + , arrivals.swelling INTO a_eid , a_behavior , a_start , a_stop , a_pid , a_role , a_participant , a_sex , a_birthdate - , a_cycle + , a_swelling FROM events JOIN roles ON (roles.eid = events.eid) @@ -397,9 +397,9 @@ CREATE OR REPLACE FUNCTION watches_func () AND roles.participant <> 'sdb_stranger_female2' AND roles.participant <> 'sdb_stranger_female3' AND biography_data.sex = 'sdb_female' - AND arrivals.cycle <> 'sdb_no_swelling' - AND arrivals.cycle <> 'sdb_adolescent_swelling' - AND arrivals.cycle <> 'sdb_missing_swelling' + AND arrivals.swelling <> 'sdb_no_swelling' + AND arrivals.swelling <> 'sdb_adolescent_swelling' + AND arrivals.swelling <> 'sdb_missing_swelling' -- Can't be sdb_male_swelling AND biography_data.birthdate > (NEW.date @@ -442,8 +442,8 @@ CREATE OR REPLACE FUNCTION watches_func () || a_birthdate || '): Key (ARRIVALS.EID) = (' || a_eid - || '), Value (ARRIVALS.Cycle) = (' - || a_cycle + || '), Value (Arrivals.Swelling) = (' + || a_swelling || ')' , HINT = 'sdb_follow_age_hint'; END IF; @@ -457,11 +457,11 @@ CREATE OR REPLACE FUNCTION watches_func () SELECT events.eid, events.behavior, events.start, events.stop , roles.pid, roles.role, roles.participant , biography_data.sex, biography_data.birthdate - , arrivals.cycle + , arrivals.swelling INTO a_eid , a_behavior , a_start , a_stop , a_pid , a_role , a_participant , a_sex , a_birthdate - , a_cycle + , a_swelling FROM events JOIN roles ON (roles.eid = events.eid) @@ -473,9 +473,9 @@ CREATE OR REPLACE FUNCTION watches_func () AND roles.participant <> 'sdb_stranger_female2' AND roles.participant <> 'sdb_stranger_female3' AND biography_data.sex = 'sdb_female' - AND arrivals.cycle <> 'sdb_no_swelling' - AND arrivals.cycle <> 'sdb_adolescent_swelling' - AND arrivals.cycle <> 'sdb_missing_swelling' + AND arrivals.swelling <> 'sdb_no_swelling' + AND arrivals.swelling <> 'sdb_adolescent_swelling' + AND arrivals.swelling <> 'sdb_missing_swelling' -- Can't be sdb_male_swelling AND biography_data.birthdate <= (NEW.date @@ -519,8 +519,8 @@ CREATE OR REPLACE FUNCTION watches_func () || a_birthdate || '): Key (ARRIVALS.EID) = (' || a_eid - || '), Value (ARRIVALS.Cycle) = (' - || a_cycle + || '), Value (Arrivals.Swelling) = (' + || a_swelling || ')' , HINT = 'sdb_follow_age_hint'; END IF; diff --git a/db/schemas/sokwedb/functions/create/build_swelling_states.m4 b/db/schemas/sokwedb/functions/create/build_swelling_states.m4 index d6dc238..78a785b 100644 --- a/db/schemas/sokwedb/functions/create/build_swelling_states.m4 +++ b/db/schemas/sokwedb/functions/create/build_swelling_states.m4 @@ -136,7 +136,7 @@ CREATE OR REPLACE FUNCTION build_swelling_states(a_animid TEXT) FROM obs JOIN arrivals ON (arrivals.eid = obs.eid) JOIN roles ON (roles.eid = obs.eid) - JOIN cycle_states ON (cycle_states.code = arrivals.cycle) + JOIN cycle_states ON (cycle_states.code = arrivals.swelling) , sighting_records WHERE roles.participant = a_animid AND cycle_states.ssrank IS NOT NULL @@ -173,12 +173,12 @@ CREATE OR REPLACE FUNCTION build_swelling_states(a_animid TEXT) AND cycle_states.ssrank IS NOT NULL AND sighting_records.code = 'sdb_arrivals_a_source' UNION - SELECT arrivals.cycle, arrivals.cycle + SELECT arrivals.swelling, arrivals.swelling , 'sdb_arrivals_source' FROM obs JOIN arrivals ON (arrivals.eid = obs.eid) JOIN roles ON (roles.eid = obs.eid) - JOIN cycle_states ON (cycle_states.code = arrivals.cycle) + JOIN cycle_states ON (cycle_states.code = arrivals.swelling) , sighting_records WHERE roles.participant = a_animid AND obs.date = a_date diff --git a/db/schemas/sokwedb/indexes/create/arrivals.m4 b/db/schemas/sokwedb/indexes/create/arrivals.m4 index 49cf3d6..9637857 100644 --- a/db/schemas/sokwedb/indexes/create/arrivals.m4 +++ b/db/schemas/sokwedb/indexes/create/arrivals.m4 @@ -24,8 +24,8 @@ include(`indexmacros.m4')dnl -- We _could_ make a covering index on EID+Seq for Seq maintenance. -- But the ARRIVALS row is going to be in RAM anyway, so why? -CREATE INDEX IF NOT EXISTS arrivals_cycle ON arrivals - (cycle); +CREATE INDEX IF NOT EXISTS arrivals_swelling ON arrivals + (swelling); CREATE INDEX IF NOT EXISTS arrivals_datasource ON arrivals (datasource); diff --git a/db/schemas/sokwedb/indexes/drop/arrivals.m4 b/db/schemas/sokwedb/indexes/drop/arrivals.m4 index 6c3e007..d05a506 100644 --- a/db/schemas/sokwedb/indexes/drop/arrivals.m4 +++ b/db/schemas/sokwedb/indexes/drop/arrivals.m4 @@ -21,5 +21,5 @@ include(`copyright.m4')dnl include(`constants.m4')dnl include(`indexmacros.m4')dnl -DROP INDEX IF EXISTS arrivals_cycle; +DROP INDEX IF EXISTS arrivals_swelling; DROP INDEX IF EXISTS arrivals_datasource; diff --git a/db/schemas/sokwedb/tables/create/arrivals.m4 b/db/schemas/sokwedb/tables/create/arrivals.m4 index 4b5a7f9..239c140 100644 --- a/db/schemas/sokwedb/tables/create/arrivals.m4 +++ b/db/schemas/sokwedb/tables/create/arrivals.m4 @@ -30,7 +30,7 @@ CREATE TABLE arrivals ( positive_check(`Seq') ,neststart BOOLEAN NOT NULL ,nestend BOOLEAN NOT NULL - ,cycle TEXT NOT NULL + ,swelling TEXT NOT NULL REFERENCES cycle_states ,datasource TEXT NOT NULL REFERENCES arrival_sources diff --git a/doc/src/epilog.inc.m4 b/doc/src/epilog.inc.m4 index 56102af..b638d26 100644 --- a/doc/src/epilog.inc.m4 +++ b/doc/src/epilog.inc.m4 @@ -150,8 +150,8 @@ sdb_generated_rst()dnl replace:: :ref:`NestStart ` .. |ARRIVALS.NestEnd| replace:: :ref:`NestEnd ` -.. |ARRIVALS.Cycle| - replace:: :ref:`Cycle ` +.. |Arrivals.Swelling| + replace:: :ref:`Swelling ` .. |ARRIVALS.DataSource| replace:: :ref:`DataSource ` .. |ARRIVALS.Updated| diff --git a/doc/src/functions/build_swelling_states.m4 b/doc/src/functions/build_swelling_states.m4 index a8d9144..ce9797b 100644 --- a/doc/src/functions/build_swelling_states.m4 +++ b/doc/src/functions/build_swelling_states.m4 @@ -82,7 +82,7 @@ are: * |ARRIVALS_A|.\ |ARRIVALS_A.Swelling| -* |ARRIVALS|.\ |ARRIVALS.Cycle|\ +* |ARRIVALS|.\ |Arrivals.Swelling|\ * |MATINGS|.\ |MATINGS.Swelling| diff --git a/doc/src/tables/arrivals.m4 b/doc/src/tables/arrivals.m4 index 48571ec..75750c2 100644 --- a/doc/src/tables/arrivals.m4 +++ b/doc/src/tables/arrivals.m4 @@ -80,7 +80,7 @@ The |OBS| view is useful when querying ARRIVALS. , obs.certainty , arrivals.neststart , arrivals.nestend - , arrivals.cycle + , arrivals.swelling , arrivals.datasource , arrivals.updated , obs.notes @@ -168,16 +168,16 @@ NestStart (in Nest at the Stop time) |ARRIVALS.NestEnd_summary| |notnull| -.. _ARRIVALS.Cycle: +.. _Arrivals.Swelling: -Cycle (Cycle state) -``````````````````` +Swelling +```````` -.. |ARRIVALS.Cycle_summary| replace:: +.. |Arrivals.Swelling_summary| replace:: A |CYCLE_STATES|.\ |CYCLE_STATES.Code| value indicating the amount of the arriving individual's sexual swelling. -|ARRIVALS.Cycle_summary| +|Arrivals.Swelling_summary| All individuals, female or not, have a value in this column, to avoid |tri-valued logic| and therefore simplify querying. diff --git a/doc/src/views/brec_notes_view.m4 b/doc/src/views/brec_notes_view.m4 index b9c323a..3bddc6a 100644 --- a/doc/src/views/brec_notes_view.m4 +++ b/doc/src/views/brec_notes_view.m4 @@ -105,7 +105,7 @@ within 5 minutes of the time the arriving chimpanzee arrived. , obs.stop AS departuretime , obs.commid , arrivals.seq, arrivals.neststart, arrivals.nestend - , arrivals.cycle, arrivals.datasource + , arrivals.swelling, arrivals.datasource FROM brec_notes_view JOIN obs ON (obs.date = brec_notes_view.date -- 2.34.1